package com.danco.training.zaneuskaya.service.comparator;

import java.io.Serializable;
import java.util.Comparator;

import com.danco.training.zaneuskaya.domain.Order;

public class OrderComparatorByPrice implements Comparator<Order>, Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 3211489167872739654L;

	public int compare(Order o1, Order o2) {
		double total1 = o1.getTotalPrice();
		double total2 = o2.getTotalPrice();

		if (total1 > total2) {
			return 1;
		} else if (total1 < total2) {
			return -1;
		}

		return 0;
	}
}
